#include<stdio.h>
int main(){int i=0,j=0,h;char ch,c[1024]={'\0'};
    int a[1024]={0};
    printf("Please input the expression:");
    while((ch=getchar())!='\n'){
        if(ch!=' ') {c[i]=ch;i++;}
    }
    c[i]='\0';
int s,k,m,n;
    for(j=0;j<i;j++){s=0;
        if(c[j]>='0'&&c[j]<='9') {k=j;                          //1 2->10*1+2
        while((c[k]>='0')&&(c[k]<='9')) {
            s=c[k]-'0'+10*s;
            k++;}
        a[j]=s;
        for(m=j+1;m<=i;m++){
        c[m]=c[m+k-j-1]; }}
        }
    n=0;
    while(c[n]!='\0') {n++;}
    int p;
    for(h=0;h<n;h++)                                            //fu shu
    for(p=0;p<n;p++){
        if ((p==0)&&(c[p+1]>='0')&&(c[p+1]<='9')&&(c[p]=='-'))
        {
            a[p]=-1*a[p+1]; c[p]=c[p+1];
            for(j=p+1;j<n;j++)     {c[j]=c[j+1];a[j]=a[j+1];}
        }
        if ((c[p]=='-')&&(c[p-1]!=')')&&((c[p-1]<'0'||c[p-1]>='9'))&&(c[p+1]>='0'&&c[p+1]<='9')&&(p!=1)) {
            a[p]=-1*a[p+1]; c[p]=c[p+1];
            for(j=p+1;j<n;j++)     {c[j]=c[j+1];a[j]=a[j+1];}
        }
    }

    n=0;
    while(c[n]!='\0') {n++;}
    for(h=0;h<n;h++)
    for(p=1;p<n;p++){
        if((c[p+1]>='0')&&(c[p+1]<='9')&&(c[p-1]>='0')&&(c[p-1]<='9')&&(c[p])=='*'){
        a[p-1]=a[p-1]*a[p+1];
        for(j=p;j<n;j++)      {c[j]=c[j+2];a[j]=a[j+2];}
        }
        if((c[p+1]>='0')&&(c[p+1]<='9')&&(c[p-1]>='0')&&(c[p-1]<='9')&&(c[p])=='/'){
        if(a[p+1]!=0){a[p-1]=a[p-1]/a[p+1];
        for(j=p;j<n;j++)      {c[j]=c[j+2];a[j]=a[j+2];}
        }
        else {printf("Error!The num2 can't be zero!");return 0;}}
        }
    n=0;
    while(c[n]!='\0') {n++;}
    for(h=0;h<n;h++)
    for(p=1;p<n;p++){
        if((c[p+1]>='0')&&(c[p+1]<='9')&&(c[p-1]>='0')&&(c[p-1]<='9')&&(c[p])=='+'){
        a[p-1]=a[p-1]+a[p+1];
        for(j=p;j<n;j++)       {c[j]=c[j+2];a[j]=a[j+2];}
        }
        if((c[p+1]>='0')&&(c[p+1]<='9')&&(c[p-1]>='0')&&(c[p-1]<='9')&&(c[p])=='-'){
        a[p-1]=a[p-1]-a[p+1];
        for(j=p;j<n;j++)       {c[j]=c[j+2];a[j]=a[j+2];}
        }}
    n=0;
    while(c[n]!='\0') {n++;}
    printf("%d\n",a[0]);
    return 0;
}